﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace OOAD_Project_Engine.Foundation
{
   public sealed class GameHelper
    {
        #region Singleton Pattern Implementation

        static readonly GameHelper instance = new GameHelper();

        private GameHelper() { }

        #endregion

        Game game;

        public static Game Game
        {
            get
            {
                return instance.game;
            }
            set
            {
                instance.game = value;
            }
        }

        public static T GetService<T>()
        {
            T t = (T)Game.Services.GetService(typeof(T));
            /*
            if (t == null) {
                throw new Exception("The requested service was not found. (" + typeof(T).ToString() + ")");
            }*/

            return t;
        }

    }
}
